package externalflame.systemdesign.newsfeed.controller;

import externalflame.systemdesign.newsfeed.entity.User;
import externalflame.systemdesign.newsfeed.service.UserService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@RestController
@RequestMapping("users")
public class UserController {

    @Autowired
    UserService userService;

    // 登录注册，不是我们关注的重点，所以这里简略地给个实现。
    @ApiOperation("登录或注册")
    @PostMapping(value = "login", produces = "application/json")
    public User login(String userName, String password) {
        User user = userService.login(userName, password);
        return user;
    }
}
